package com.hl.shifangzhiyu.web;

import com.hl.shifangzhiyu.pojo.InfoNotice;
import com.hl.shifangzhiyu.service.InfoNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/infoNotice")
public class InfoNoticeController {
    @Autowired
    private InfoNoticeService service;
    @RequestMapping
  public List<InfoNotice> listAll(){
      return service.getAll();
  }
  @RequestMapping("/{id}")
    public InfoNotice getById(@PathVariable int id){
        return service.getById(id);
  }
  @PostMapping
    public void add(@RequestBody  InfoNotice infoNotice){
      service.save(infoNotice);
  }
  @PutMapping
    public void update(@RequestBody InfoNotice infoNotice){
      service.update(infoNotice);
  }
  @DeleteMapping("/{id}")
    public void delete(@PathVariable int id){
        service.delete(id);
  }

}
